﻿using System;
using System.Web;
using gms.data;
using gms.security;

namespace gms.system {
	public static class MenuGenerator {
		public static string Generate() {
			string retval = "";
			Player checker = Player.load_by_id(Authentication.AuthedPlayer);

			retval += "<a href=\"/default.aspx\">Home</a>";

			if (Authentication.IsSessionAuthed()) {
				if (checker.test(AclType.ManageAclgroups & AclType.ManageFlaggedContent & AclType.ManageOpcodes & AclType.ManagePlayers & AclType.ManagePlugins & AclType.ManageUploads)) {
					retval += "<a href=\"/admin/default.aspx\">Status</a>";
				}
				if (checker.test(AclType.ManagePlayers)) {
					retval += "<a href=\"/admin/playermgr.aspx\">Players</a>";
				}
				if (checker.test(AclType.ManageAclgroups)) {
					retval += "<a href=\"/admin/aclmgr.aspx\">Groups</a>";
				}

				retval += "<a href=\"/login.aspx\">Log Out</a>";
			}
			else {
				retval += "<a href=\"/login.aspx\">Log In</a>";
			}

			return retval;
		}
	}
}